import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import dict from '@/store/modules/dict'
import user from '@/store/modules/user'
import learning from '@/store/modules/learning'
import getters from './getters'
import sw from '@/store/modules/service-worker'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    dict,
    user,
    learning,
    sw
  },
  getters,
  plugins: [
    // veux持久化配置
    createPersistedState({
      key: 'app_config_data_learning',
      paths: ['user']
    })
  ]
})

export default store
